﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using Microsoft.Reporting.WinForms;
namespace AppAcc.Views.BaoCao
{
    public partial class FormBaoCaoSoQuyTienMat : Form
    {
        public FormBaoCaoSoQuyTienMat()
        {
            InitializeComponent();
        }
        string SoTK;
        DateTime dt1, dt2;
        public FormBaoCaoSoQuyTienMat(string SoTK1,DateTime d1,DateTime d2)
        {
            InitializeComponent();
            SoTK = SoTK1.Trim();
            dt1 = d1;
            dt2 = d2;
        }

        private void FormBaoCaoSoQuyTienMat_Load(object sender, EventArgs e)
        {

            try
            {
               // this.pr_SoThuChiTableAdapter.Fill(this.dS_SoQuyTienMat.pr_SoThuChi, SoTK, dt1, dt2);
                this.pr_SoQuyTienMatTableAdapter.Fill(this.dataSet_SoQuyTienMat.pr_SoQuyTienMat, SoTK, dt1, dt2);
                ReportParameter[] rptParams = new ReportParameter[]
            {
                new ReportParameter("SoTK",SoTK), 
                new ReportParameter("TuNgay",Convert.ToString(dt1)),
                new ReportParameter("DenNgay",Convert.ToString(dt2)),
            };
                reportViewer1.LocalReport.SetParameters(rptParams);
                this.reportViewer1.RefreshReport();
            }
            catch (Exception)
            {
                this.pr_SoQuyTienMatTableAdapter.Fill(this.dataSet_SoQuyTienMat.pr_SoQuyTienMat, SoTK, dt1, dt2);
                ReportParameter[] rptParams = new ReportParameter[]
            {
                new ReportParameter("SoTK",SoTK), 
                new ReportParameter("TuNgay",Convert.ToString(dt1)),
                new ReportParameter("DenNgay",Convert.ToString(dt2)),
            };
                reportViewer1.LocalReport.SetParameters(rptParams);
                this.reportViewer1.RefreshReport();
                //  throw;
            }
        }
    }
}
